package org.ucas.faker.web.entity;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;

@Table(name = "query")
@Entity
public class Query extends IdEntity {

  public Query() {}

  public Query(Long userId, String content, int type) {
    this.userId = userId;
    this.content = content;
    this.type = type;
    this.createAt = new Date();
  }

  public Query(Long userId, String content) {
    this(userId,content,0);
  }

  private Long userId;

  private String content;

  private int type = 0;

  @Transient
  private String time;

  public Long getUserId() {
    return userId;
  }

  public void setUserId(Long userId) {
    this.userId = userId;
  }

  public String getContent() {
    return content;
  }

  public void setContent(String content) {
    this.content = content;
  }

  public int getType() {
    return type;
  }

  public void setType(int type) {
    this.type = type;
  }

  public String getTime() {
    if(time == null && createAt != null) time = createAt.toString();
    return time;
  }

  public void setTime(String time) {
    this.time = time;
  }
}
